<?php
namespace Common\Controller;
use Think\Controller;
use Common\Controller\ConfigController;
class CommonController extends Controller {
    protected $config;
    protected $banner;
    protected $trade;
    protected $member;
    protected $dividendConfig;
    public function _initialize(){
    	$banner=M('Banner')->where(array('position_id'=>2,'status'=>1))->getField('pic');	
    	$list=M("Config")->select();
    	foreach ($list as $k=>$v){
    		$list[$v['key']]=$v['value'];
    	}
		$this->assign('config',$list);
		$this->assign('banner',$banner);
		$this->config = $list;
		/*
		 *左侧导航 
		 */
		//左侧产品列表 left
		$where3["status"]=array("NEQ","-1");
		$where3["pid"]=0;
		$product_type=M("Ptype")->where($where3)->select();
		
		//左侧产品列表 left1
		//分级类别的显示
		//分类显示
		//以一级分类为基础，形成遍历
		foreach ($product_type as $k=>$v){
			//加入二级分类，以一级id为查询条件
			$where4["pid"]=$v["tid"];
			$where4["status"]=array("NEQ","-1");
// 						dump(M("Ptype")->where($where4)->select());die;
			$product_type[$k]["children"]=M("Ptype")->where($where4)->select();
// 			dump($product_type[$k]["children"]);die;
		}
		$this->assign("product_type",$product_type);
		/*
		 * 底部
		 */
		//友情链接
		$link=M("Link")->where("status",array("NEQ","-1"))->select();
		$this->assign("link",$link);
	}
		
	
}

